package thingtest.game;

public class Thing {

	private Vector speed;
	private Vector location;
	private double radius;
	private Vector directionThisIsFacing;
	
	public Thing(){
		this.location = new Vector();
		this.speed= new Vector();
		this.radius = 1;
		this.directionThisIsFacing = new Vector(20,0);
	}

	public void push(Vector speed) {

		this.speed = speed;
		
	}

	public Vector speed() {

		return speed;
	}

	public Vector location() {

		return this.location;
	}

	public void advance() {

		this.location.add(speed);
		
	}

	public void moveToThisPoint(Vector vector) {
		this.location = vector;
		
	}

	public void defineRadius(double radius) {
		this.radius = radius;
		
	}

	public boolean isInRadiusOf(Thing anotherThing) {

		if (anotherThing.distanceFrom(this).norm() < anotherThing.radius) return true;
		else return false;
	}

	private Vector distanceFrom(Thing anotherThing) {

		return this.location.minus(anotherThing.location);
	}

	public double radius() {
		return radius;
	}

	public void faceTowards(Vector vector) {

		this.directionThisIsFacing = vector.minus(this.location);
		
	}

	public Vector directionThisIsFacing() {
		return directionThisIsFacing;
	}

}
